package com.xyg.sample.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import com.xyg.common.model.DataEntity;

@Entity
@Table(name="student")
public class Student extends DataEntity<Student, Long> {

	@Column(length=20)
	private String name;
	
	private int age;
	
	private Gender gender;
	
	@ManyToMany(fetch=FetchType.LAZY)
	private Set<Score> scores = new HashSet<>();
	
	public Student () {
		super();
		this.gender = Gender.male;
	}
	
	public Student (Long id) {
		super(id);
	}
	
	public enum Gender {
		male("男"),female("女");
		private String text;
		
		private Gender(String text) {
			this.text = text;
		}

		public String getText() {
			return text;
		}

		public void setText(String text) {
			this.text = text;
		}
		
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public Gender getGender() {
		return gender;
	}

	public void setGender(Gender gender) {
		this.gender = gender;
	}

	public Set<Score> getScores() {
		return scores;
	}

	public void setScores(Set<Score> scores) {
		this.scores = scores;
	}
	
	
	
}
